home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_indy.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  370 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_Indy.cog
  4. #
  5. # [RT]
  6. #
  7. # Indy's script.
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15.     message        startup
  16. #    message        created
  17.     message        damaged
  18.     message        killed
  19.     message        splash
  20.     message        callback
  21.     message        pulse
  22.     message        user0
  23.     message        user1
  24.     message        user2
  25.     message        user3
  26.     message        user6
  27.     message        user7
  28.  
  29.     keyframe    hatSpin=gen_hat_spin.key        local
  30.  
  31.     material    mat=gen_a4sfx_splash.mat        local
  32.  
  33.     model        noHatHead=head_in_goodhair.3do    local
  34.     model        hatHand=hand_in_hat.3do            local
  35.     model        guybrush=aet_gy.3do                local
  36.     model        saveModel                        local
  37.  
  38.     sound        burnSnd=gen_torchlitet_c.wav    local
  39.  
  40.     template    tpl_Splash=splashenter            local
  41.     template    tpl_Spray=+spray                local
  42.     template    tpl_Ripple=+ripples                local
  43.  
  44.     template    tpl_Fire=+bazooka_exp_fire        local
  45.     template    tpl_Smoke=+bazooka_exp_smoke    local
  46.     template    tpl_Sparks=lavadeathsparks        local
  47.  
  48.     template    tpl_Hat=hat                        local
  49.  
  50.     thing        indy                            local
  51.     thing        tempIndy                        local
  52.     thing        newThing                        local
  53.  
  54.     flex        poisonDamage=5.0                local
  55.  
  56.     int            hatMesh                            local
  57.     int            headMesh                        local
  58.     int            handMesh                        local
  59.     int            hatMeshRef                        local
  60.     int            headMeshRef                        local
  61.     int            handMeshRef                        local
  62.  
  63.     int            param                            local
  64.     int            index                            local
  65.     int            damageType                        local
  66.  
  67.     int            bPoisoned=0                        local
  68.     int            bGuybrush=0                        local
  69.  
  70.     sector        createSec                        local
  71.     vector        createPos                        local
  72.  
  73. # ************************ SUBROUTINES *************************
  74.  
  75.     flex        SplashGenerator                    local
  76.     flex        RippleGenerator                    local
  77.  
  78. end
  79.  
  80. # ===================================================================
  81.  
  82. code
  83.  
  84. startup:
  85.  
  86.     indy = GetLocalPlayerThing();
  87.  
  88.     hatMesh = GetMeshByName(indy, "inhat");
  89.     headMesh = GetMeshByName(indy, "inhead");
  90.     handMesh = GetMeshByName(indy, "inrhand");
  91.  
  92.     # Indy gets the pistol & whip
  93.     SetInv(indy, 2, 1);
  94.     SetInvAvailable(indy, 2, 1);
  95.     SetInv(indy, 3, 1);
  96.     SetInvAvailable(indy, 3, 1);
  97.  
  98.     # Set up Indy heads...
  99.     SetThingVoiceHeads(indy, "inhead", "", "head_in_asound.3do", "head_in_amsound.3do", "head_in_osound.3do");
  100.  
  101.     # Voice settings for ALL actors...
  102.     SetVoiceHeadHeight(0, 0, 0, 0, 0);
  103.     SetVoiceHeadHeight(1, 1, 1, 1, 1);
  104.     SetVoiceHeadHeight(2, 2, 2, 2, 2);
  105.     SetVoiceHeadHeight(3, 3, 3, 3, 3);
  106.  
  107.     SetVoiceParams(0.15, 250);
  108.  
  109.     return;
  110.  
  111. # -------------------------------------------------------------------
  112.  
  113. #created:
  114.  
  115.     # Enable weapons in case Indy died in the water
  116. #    SetSwimmingInventory(indy, 1);
  117.  
  118. #    return;
  119.  
  120. # -------------------------------------------------------------------
  121.  
  122. damaged:
  123.  
  124.     # Set this every time so that damage in other vehicles works.
  125.     tempIndy = GetLocalPlayerThing();
  126.  
  127.     if (!bPoisoned)
  128.     {
  129.         if ((GetParam(1) == 0x100) && (!BitTest(GetActorFlags(tempIndy), 0x8)))
  130.         {
  131.             bPoisoned = 1;
  132.  
  133.             if (Rand() < 0.33)
  134.                 PlayVoiceMode(tempIndy, 92);
  135.  
  136.             SetActorFlags(tempIndy, 0x2000);
  137.             SetPulse(1.0);
  138.         }
  139.     }
  140.  
  141.     return;
  142.  
  143. # -------------------------------------------------------------------
  144.  
  145. killed:
  146.  
  147.     damageType = GetParam(1);
  148.     
  149.     # Killed by lava?
  150.     if (damageType == 0x200)
  151.     {
  152.         Sleep(0.1);
  153.         CreateThing(tpl_Fire, indy);
  154.         PlaySoundThing(burnSnd, indy, 1.0, -1, -1, 0x0);
  155.         Sleep(0.3);
  156.         CreateThing(tpl_Smoke, indy);
  157.         SetThingFlags(indy, 0x80000);
  158.  
  159.         for (index = 0; index < 10; index = index + 1)
  160.         {
  161.             CreateThing(tpl_Sparks, indy);
  162.             Sleep(0.03);
  163.         }
  164.     }
  165.     # Killed by cold water?
  166.     else if (damageType == 0x40000000)
  167.     {
  168.         # Where we is?
  169.         createSec = GetThingSector(indy);
  170.         createPos = GetThingPos(indy);
  171.         createPos = VectorAdd(createPos, '0.0 0.0 -0.09');
  172.  
  173.         # Splash and wait for death anim to finish
  174.         call SplashGenerator;
  175.         Sleep(0.2);
  176.         call RippleGenerator;
  177.         Sleep(0.4);
  178.  
  179.         # Poor Indy lost his hat...
  180.         createSec = GetThingSector(indy);
  181.         createPos = GetThingPos(indy);
  182.         createPos = VectorAdd(createPos, '0.0 0.0 -0.025');
  183.         newThing = CreateThingAtPos(tpl_Hat, createSec, createPos, '0 0 0');
  184.         PlayKey(newThing, hatSpin, 5, 0x0, 0);
  185.         
  186.         # Make him disappear, just in case...
  187.         SetThingFlags(indy, 0x80000);
  188.     }
  189.  
  190.     return;
  191.  
  192. # -------------------------------------------------------------------
  193.  
  194. splash:
  195.  
  196.     # Splash message sources: 1 = entering water; 0 = leaving water
  197.     
  198.     if (GetSenderRef() != indy) return;
  199.     
  200.     if (GetSourceRef() == 1)
  201.     {
  202.         # Put away drawn weapon
  203.         if (GetCurWeapon(indy) != 7)
  204.         {
  205.             DeselectWeapon(indy);
  206.         }
  207.  
  208.         # No weapons, etc. except machete while swimming!
  209.         SetSwimmingInventory(indy, 0);
  210.  
  211.         # Get rid of the hat and put on a new head
  212.         if (!bGuybrush)
  213.         {
  214.             headMeshRef = SetThingMesh(indy, headMesh, noHatHead, 0);
  215.             hatMeshRef = SetThingMesh(indy, hatMesh, noHatHead, 1);
  216.         }
  217.  
  218.         # Where the heck are we?
  219.         createSec = GetThingSector(indy);
  220.         createPos = GetThingPos(indy);
  221.  
  222.         call SplashGenerator;
  223.         Sleep(0.4);
  224.         call RippleGenerator;
  225.     }
  226.     else
  227.     {
  228.         # Restore weapons
  229.         SetSwimmingInventory(indy, 1);
  230.     }
  231.  
  232.     return;
  233.  
  234. # -------------------------------------------------------------------
  235.  
  236. callback:
  237.  
  238.     # if (pThing->moveStatus != SITHPLAYERMOVE_PULLINGUP) 
  239.     if (GetMoveStatus(indy) != 26) return;
  240.  
  241.     param = GetParam(1);
  242.  
  243.     if (!bGuybrush)
  244.     {
  245.         if (param == 21)
  246.         {
  247.             # Put the hat in Indy's hand
  248.             handMeshRef = SetThingMesh(indy, handMesh, hatHand, 0); 
  249.             return;
  250.         }
  251.         else if (param == 22)
  252.         {
  253.             # Now take it out of his hand and put it on his head
  254.             RestoreThingMesh(indy, handMeshRef);
  255.             RestoreThingMesh(indy, headMeshRef);
  256.             RestoreThingMesh(indy, hatMeshRef);
  257.             return;
  258.         }
  259.     }
  260.  
  261. # -------------------------------------------------------------------
  262.  
  263. pulse:
  264.  
  265.     # Get so that in vehicle stuff will work        
  266.     tempIndy = GetLocalPlayerThing();
  267.  
  268.     if(BitTest(GetActorFlags(tempIndy), 0x2000))
  269.     {
  270.         DamageThing(tempIndy, poisonDamage, 0x100, indy);
  271.     }
  272.     else
  273.     {
  274.         SetPulse(0);
  275.         bPoisoned = 0;
  276.     }
  277.  
  278.     return;
  279.  
  280. # -------------------------------------------------------------------
  281.  
  282. user0:
  283.  
  284.     # user0 = Guybrush cheat on
  285.     saveModel = GetThingModel(indy);
  286.     SetThingModel(indy, guybrush);
  287.     bGuybrush = 1;
  288.  
  289.     return;
  290.  
  291. # -------------------------------------------------------------------
  292.  
  293. user1:
  294.  
  295.     # user1 = Guybrush cheat off
  296.     SetThingModel(indy, saveModel);
  297.     bGuybrush = 0;
  298.  
  299.     return;
  300.  
  301. # -------------------------------------------------------------------
  302.  
  303. user2:
  304.  
  305.     # user2 = Cutscene started
  306.     if (bPoisoned)
  307.         SetPulse(0);
  308.  
  309.     return;
  310.  
  311. # -------------------------------------------------------------------
  312.  
  313. user3:
  314.  
  315.     # user3 = Cutscene ended
  316.     if (bPoisoned)
  317.         SetPulse(1.0);
  318.  
  319.     return;
  320.  
  321. # -------------------------------------------------------------------
  322.  
  323. user6:
  324.  
  325.     # user6 = start writing with chalk...
  326.     SetActorFlags(indy, 0x200000);
  327.     StopThing(indy);
  328.     StartCutScene(0);
  329.     return;
  330.  
  331. # -------------------------------------------------------------------
  332.  
  333. user7:
  334.  
  335.     # user7 = end writing with chalk...
  336.     ClearActorFlags(indy, 0x200000);
  337.     EndCutScene();
  338.     return;
  339.  
  340. # -------------------------------------------------------------------
  341.  
  342. SplashGenerator: # Assumes createSec & createPos are already set...
  343.  
  344.     # Make a splash...
  345.     CreateThingAtPos(tpl_Splash, createSec, createPos, '0 0 0');
  346.     MaterialAnim(mat, 12.0, 0x0);
  347.  
  348.     # ...and some spray
  349.     newThing = CreateThingAtPos(tpl_Spray, createSec, createPos, '0 0 0');
  350.     SetThingFlags(newThing, 0x8000000);
  351.  
  352.     return;
  353.  
  354. # -------------------------------------------------------------------
  355.  
  356. RippleGenerator: # Assumes createSec & createPos are already set...
  357.  
  358.     # Make some ripples
  359.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '0.02 0.0 0.0'), '0 0 0');
  360.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.5 0.5 0.0', 0.5);
  361.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '-0.02 0.0 0.0'), '0 0 0');
  362.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.4 0.4 0.0', 0.5);
  363.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '0.0 0.02 0.0'), '0 0 0');
  364.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.4 0.4 0.0', 0.5);
  365.     newThing = CreateThingAtPos(tpl_Ripple, createSec, VectorAdd(createPos, '0.0 -0.02 0.0'), '0 0 0');
  366.     AnimateSpriteSize(newThing, '0.28 0.28 1.0', '0.4 0.4 0.0', 0.5);
  367.  
  368.     return;
  369.  
  370. end